package com.yhb.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yhb.channel.model.IUserIdentify;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class Certificate implements IUserIdentify {

    @JsonIgnore
    private String userId;

    private String name;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String idCode;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String idAvatarUrl; // 头像面照片url

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String idEmblemUrl; // 国徽面照片url

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String photoUrl; // 真人照片, 调用实人认证接口后拍照上传oss

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String validation; // 有效期

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String address;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long score;

    @JsonIgnore
    private String idCodeMd5;

    private Date createTime;

    @JsonIgnore
    @Override
    public String getIdCardImgBackUrl() {
        return getIdEmblemUrl();
    }

    @JsonIgnore
    @Override
    public String getIdCardImgFrontUrl() {
        return getIdAvatarUrl();
    }

    @JsonIgnore
    @Override
    public String getIdCardNum() {
        return getIdCode();
    }

    @JsonIgnore
    @Override
    public String getUserName() {
        return getName();
    }
}
